\(\int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx\) [752]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 43, antiderivative size = 101 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {4 a^2 (i A+B)}{f \sqrt {c-i c \tan (e+f x)}}-\frac {2 a^2 (i A+3 B) \sqrt {c-i c \tan (e+f x)}}{c f}+\frac {2 a^2 B (c-i c \tan (e+f x))^{3/2}}{3 c^2 f} \]

[Out]

-4*a^2*(I*A+B)/f/(c-I*c*tan(f*x+e))^(1/2)-2*a^2*(I*A+3*B)*(c-I*c*tan(f*x+e))^(1/2)/c/f+2/3*a^2*B*(c-I*c*tan(f*
x+e))^(3/2)/c^2/f

Rubi [A] (verified)

Time = 0.20 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.047, Rules used = {3669, 78} \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {2 a^2 (3 B+i A) \sqrt {c-i c \tan (e+f x)}}{c f}-\frac {4 a^2 (B+i A)}{f \sqrt {c-i c \tan (e+f x)}}+\frac {2 a^2 B (c-i c \tan (e+f x))^{3/2}}{3 c^2 f} \]

[In]

Int[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/Sqrt[c - I*c*Tan[e + f*x]],x]

[Out]

(-4*a^2*(I*A + B))/(f*Sqrt[c - I*c*Tan[e + f*x]]) - (2*a^2*(I*A + 3*B)*Sqrt[c - I*c*Tan[e + f*x]])/(c*f) + (2*
a^2*B*(c - I*c*Tan[e + f*x])^(3/2))/(3*c^2*f)

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int \frac {(a+i a x) (A+B x)}{(c-i c x)^{3/2}} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a c) \text {Subst}\left (\int \left (\frac {2 a (A-i B)}{(c-i c x)^{3/2}}-\frac {a (A-3 i B)}{c \sqrt {c-i c x}}-\frac {i a B \sqrt {c-i c x}}{c^2}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = -\frac {4 a^2 (i A+B)}{f \sqrt {c-i c \tan (e+f x)}}-\frac {2 a^2 (i A+3 B) \sqrt {c-i c \tan (e+f x)}}{c f}+\frac {2 a^2 B (c-i c \tan (e+f x))^{3/2}}{3 c^2 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 4.09 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.61 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {2 a^2 \left (9 i A+14 B+(3 A-7 i B) \tan (e+f x)+B \tan ^2(e+f x)\right )}{3 f \sqrt {c-i c \tan (e+f x)}} \]

[In]

Integrate[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/Sqrt[c - I*c*Tan[e + f*x]],x]

[Out]

(-2*a^2*((9*I)*A + 14*B + (3*A - (7*I)*B)*Tan[e + f*x] + B*Tan[e + f*x]^2))/(3*f*Sqrt[c - I*c*Tan[e + f*x]])

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.93

method result size
derivativedivides \(\frac {2 i a^{2} \left (-\frac {i B \left (c -i c \tan \left (f x +e \right )\right )^{\frac {3}{2}}}{3}+3 i \sqrt {c -i c \tan \left (f x +e \right )}\, B c -\sqrt {c -i c \tan \left (f x +e \right )}\, c A -\frac {2 c^{2} \left (-i B +A \right )}{\sqrt {c -i c \tan \left (f x +e \right )}}\right )}{f \,c^{2}}\) \(94\)
default \(\frac {2 i a^{2} \left (-\frac {i B \left (c -i c \tan \left (f x +e \right )\right )^{\frac {3}{2}}}{3}+3 i \sqrt {c -i c \tan \left (f x +e \right )}\, B c -\sqrt {c -i c \tan \left (f x +e \right )}\, c A -\frac {2 c^{2} \left (-i B +A \right )}{\sqrt {c -i c \tan \left (f x +e \right )}}\right )}{f \,c^{2}}\) \(94\)
parts \(\frac {2 i A \,a^{2} c \left (-\frac {1}{2 c \sqrt {c -i c \tan \left (f x +e \right )}}+\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{4 c^{\frac {3}{2}}}\right )}{f}+\frac {a^{2} \left (2 i A +B \right ) \left (-\frac {1}{\sqrt {c -i c \tan \left (f x +e \right )}}-\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{2 \sqrt {c}}\right )}{f}-\frac {2 B \,a^{2} \left (-\frac {\left (c -i c \tan \left (f x +e \right )\right )^{\frac {3}{2}}}{3}+c \sqrt {c -i c \tan \left (f x +e \right )}+\frac {c^{2}}{2 \sqrt {c -i c \tan \left (f x +e \right )}}+\frac {c^{\frac {3}{2}} \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{4}\right )}{f \,c^{2}}-\frac {2 i a^{2} \left (-2 i B +A \right ) \left (\sqrt {c -i c \tan \left (f x +e \right )}+\frac {c}{2 \sqrt {c -i c \tan \left (f x +e \right )}}-\frac {\sqrt {c}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{4}\right )}{f c}\) \(301\)

[In]

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2),x,method=_RETURNVERBOSE)

[Out]

2*I/f*a^2/c^2*(-1/3*I*B*(c-I*c*tan(f*x+e))^(3/2)+3*I*(c-I*c*tan(f*x+e))^(1/2)*B*c-(c-I*c*tan(f*x+e))^(1/2)*c*A
-2*c^2*(A-I*B)/(c-I*c*tan(f*x+e))^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.92 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {2 \, \sqrt {2} {\left (3 \, {\left (i \, A + B\right )} a^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (3 i \, A + 5 \, B\right )} a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, {\left (3 i \, A + 5 \, B\right )} a^{2}\right )} \sqrt {\frac {c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}}}{3 \, {\left (c f e^{\left (2 i \, f x + 2 i \, e\right )} + c f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2),x, algorithm="fricas")

[Out]

-2/3*sqrt(2)*(3*(I*A + B)*a^2*e^(4*I*f*x + 4*I*e) + 3*(3*I*A + 5*B)*a^2*e^(2*I*f*x + 2*I*e) + 2*(3*I*A + 5*B)*
a^2)*sqrt(c/(e^(2*I*f*x + 2*I*e) + 1))/(c*f*e^(2*I*f*x + 2*I*e) + c*f)

Sympy [F]

\[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=- a^{2} \left (\int \left (- \frac {A}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\right )\, dx + \int \frac {A \tan ^{2}{\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\, dx + \int \left (- \frac {B \tan {\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\right )\, dx + \int \frac {B \tan ^{3}{\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\, dx + \int \left (- \frac {2 i A \tan {\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\right )\, dx + \int \left (- \frac {2 i B \tan ^{2}{\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c}}\right )\, dx\right ) \]

[In]

integrate((a+I*a*tan(f*x+e))**2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**(1/2),x)

[Out]

-a**2*(Integral(-A/sqrt(-I*c*tan(e + f*x) + c), x) + Integral(A*tan(e + f*x)**2/sqrt(-I*c*tan(e + f*x) + c), x
) + Integral(-B*tan(e + f*x)/sqrt(-I*c*tan(e + f*x) + c), x) + Integral(B*tan(e + f*x)**3/sqrt(-I*c*tan(e + f*
x) + c), x) + Integral(-2*I*A*tan(e + f*x)/sqrt(-I*c*tan(e + f*x) + c), x) + Integral(-2*I*B*tan(e + f*x)**2/s
qrt(-I*c*tan(e + f*x) + c), x))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.80 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {2 i \, {\left (\frac {6 \, {\left (A - i \, B\right )} a^{2} c}{\sqrt {-i \, c \tan \left (f x + e\right ) + c}} + \frac {i \, {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{\frac {3}{2}} B a^{2} + 3 \, \sqrt {-i \, c \tan \left (f x + e\right ) + c} {\left (A - 3 i \, B\right )} a^{2} c}{c}\right )}}{3 \, c f} \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2),x, algorithm="maxima")

[Out]

-2/3*I*(6*(A - I*B)*a^2*c/sqrt(-I*c*tan(f*x + e) + c) + (I*(-I*c*tan(f*x + e) + c)^(3/2)*B*a^2 + 3*sqrt(-I*c*t
an(f*x + e) + c)*(A - 3*I*B)*a^2*c)/c)/(c*f)

Giac [F]

\[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=\int { \frac {{\left (B \tan \left (f x + e\right ) + A\right )} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{2}}{\sqrt {-i \, c \tan \left (f x + e\right ) + c}} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2),x, algorithm="giac")

[Out]

integrate((B*tan(f*x + e) + A)*(I*a*tan(f*x + e) + a)^2/sqrt(-I*c*tan(f*x + e) + c), x)

Mupad [B] (verification not implemented)

Time = 9.19 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.74 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{\sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {2\,\sqrt {2}\,a^2\,\sqrt {\frac {c}{\cos \left (2\,e+2\,f\,x\right )+1+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}}}\,\left (A\,6{}\mathrm {i}+10\,B+A\,\cos \left (2\,e+2\,f\,x\right )\,9{}\mathrm {i}+A\,\cos \left (4\,e+4\,f\,x\right )\,3{}\mathrm {i}+15\,B\,\cos \left (2\,e+2\,f\,x\right )+3\,B\,\cos \left (4\,e+4\,f\,x\right )-9\,A\,\sin \left (2\,e+2\,f\,x\right )-3\,A\,\sin \left (4\,e+4\,f\,x\right )+B\,\sin \left (2\,e+2\,f\,x\right )\,15{}\mathrm {i}+B\,\sin \left (4\,e+4\,f\,x\right )\,3{}\mathrm {i}\right )}{3\,c\,f\,\left (\cos \left (2\,e+2\,f\,x\right )+1+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )} \]

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^2)/(c - c*tan(e + f*x)*1i)^(1/2),x)

[Out]

-(2*2^(1/2)*a^2*(c/(cos(2*e + 2*f*x) + sin(2*e + 2*f*x)*1i + 1))^(1/2)*(A*6i + 10*B + A*cos(2*e + 2*f*x)*9i +
A*cos(4*e + 4*f*x)*3i + 15*B*cos(2*e + 2*f*x) + 3*B*cos(4*e + 4*f*x) - 9*A*sin(2*e + 2*f*x) - 3*A*sin(4*e + 4*
f*x) + B*sin(2*e + 2*f*x)*15i + B*sin(4*e + 4*f*x)*3i))/(3*c*f*(cos(2*e + 2*f*x) + sin(2*e + 2*f*x)*1i + 1))